import { _decorator, Component, Label, Node, tween, Vec2, Vec3 } from 'cc';
import { eventDispatcher } from './eventDispatcher';
const { ccclass, property } = _decorator;

@ccclass('tipsAction')
export class tipsAction extends Component {
    @property(Label) label_msg:Label = null;
    start() {
        this.node.setPosition(0,-1000);
        eventDispatcher.get_target().on(eventDispatcher.TIPS_MSG,this.show_tips,this)
    }
    show_tips(msg:string){
        this.label_msg.string = msg;
        this.node.setPosition(0,-50);
        tween(this.node)
        .to(0.5,{position:new Vec3(0,0,0)})
        .to(0.2,{position:new Vec3(0,700,0)})
        .call(()=>{
            this.node.setPosition(0,-1000)
        }).start();
    }
    update(deltaTime: number) {
        
    }
}


